package net.zdreamer.geracomium.ui.more;

import net.zdreamer.geracomium.adapter.FoodIndentAdapter;
import net.zdreamer.geracomium.entity.FoodIndentInfos;
import net.zdreamer.geracomium.ui.BaseActivity;

import android.view.View;
import android.view.View.OnClickListener;

import com.example.geracomium.R;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;

public class FoodIndentActivity extends BaseActivity implements OnClickListener {
	private PullToRefreshListView pullToRefreshListView;
	private FoodIndentAdapter mAdapter;

	@Override
	protected int getContentView() {
		// TODO Auto-generated method stub
		return R.layout.activity_foodindent;
	}

	@Override
	protected void init() {
		// TODO Auto-generated method stub
		pullToRefreshListView = (PullToRefreshListView) findViewById(R.id.foodindent_list);
	}

	@Override
	protected void initViews() {
		initTitle("膳食订餐订单", R.drawable.selector_title_back,
				R.drawable.seletor_cancel_order, true, true);
		pullToRefreshListView.setMode(Mode.BOTH);
		// pullToRefreshListView.setOnRefreshListener(orl);
		FoodIndentInfos foodinfo = new FoodIndentInfos();
		mAdapter = new FoodIndentAdapter(this, foodinfo.days,
				R.layout.foodinfo_days);
		pullToRefreshListView.setAdapter(mAdapter);
	}

	@Override
	protected void initListener() {
		findViewById(R.id.back).setOnClickListener(this);
		findViewById(R.id.share).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.back:
			FoodIndentActivity.this.finish();
			break;
		case R.id.share:
			break;
		default:
			break;
		}
	}
	/*
	 * private OnRefreshListener<ListView> orl = new
	 * OnRefreshListener<ListView>() {
	 * 
	 * @Override public void onRefresh(PullToRefreshBase<ListView> refreshView)
	 * { String label = DateUtils.formatDateTime(FoodIndentActivity.this
	 * .getApplicationContext(), System.currentTimeMillis(),
	 * DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE |
	 * DateUtils.FORMAT_ABBREV_ALL);
	 * 
	 * refreshView.getLoadingLayoutProxy().setLastUpdatedLabel( "上次刷新：" +
	 * label);
	 * 
	 * Thread a = new Thread(new Runnable() {
	 * 
	 * @Override public void run() { try { Thread.sleep(2000); } catch
	 * (InterruptedException e) { e.printStackTrace(); } Message message = new
	 * Message(); message.what = 0; h.sendMessage(message); } }); a.start(); }
	 * }; Handler h = new Handler() {
	 * 
	 * @Override public void handleMessage(Message msg) { if (msg.what == 0) {
	 * FoodIndentInfos foodinfo = new FoodIndentInfos(); mAdapter = new
	 * FoodIndentAdapter(FooddaysAdapter.this, foodinfo.days,
	 * R.layout.foodinfo_days); pullToRefreshListView.setAdapter(mAdapter);
	 * pullToRefreshListView.onRefreshComplete(); } }
	 * 
	 * };
	 */

}
